// reducer 函数
import { LOGIN, LOGOUT } from '@/store/actionTypes'
const initState = { token: '' }
export default function login(state = initState , action) {
    console.log('login', state, action)
    if(action.type === LOGIN) {
        return { ...state, token: action.payload }
    } else if(action.type === LOGOUT) {
        return { ...state, token: '' }
    }
    return state
}